<%@page import="com.webapp.org.service.DepartmentService"%>
<%@page import="com.webapp.org.bean.DepartmentBean"%>
<%@page import="java.util.List"%>
<%@page import="com.webapp.org.dao.DepartmentDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.ResourceBundle"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	ResourceBundle resource1 = ResourceBundle.getBundle("resources.messageBundle.MessagesBundle_hi_IN");
	
	List<DepartmentBean> result =new DepartmentService().retrieveDepartment();
	
%>
<!DOCTYPE>
<html>
<head>
<base href="<%=basePath%>">
<title><%= resource1.getString("employee_management") %>....<%= resource1.getString("department_title") %></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/style.css" />

<script src="js/cufon-yui.js" type="text/javascript"></script>
<script src="js/ChunkFive_400.font.js" type="text/javascript"></script>

<script src="js/mr_mangal.js"></script>
<script src="js/Parser_mangal.js"></script>

<script>
				Cufon.replace('h1',{ textShadow: '1px 1px #fff'});
				Cufon.replace('h2',{ textShadow: '1px 1px #fff'});
				Cufon.replace('h3',{ textShadow: '1px 1px #000'});
				Cufon.replace('.back');
</script>
 <script>
 function callFun(fId,fdepartmentName,fdeparmentRemark)
 {
		alert("hi..."+fId+fdepartmentName+fdeparmentRemark);
		document.getElementsByName('deparmentSrno')[0].value = fId;
		document.getElementsByName('depatmentName')[0].value = fdepartmentName;
		document.getElementsByName('depatmentRemark')[0].value = fdeparmentRemark;
			
		document.getElementById("submitDepartmentAdd").style.display="none";
		document.getElementById("submit_add").style.display="none";
		
 }
</script>

</head>
<body>
    		
			<%@ include  file="/jsp_pages/HeaderwithMenu.jsp" %>
			<div id="form_wrapper" class="form_wrapper1">	
					<form class="login1 active1" method="get" name="frm1" action="DepartmentServlet.do">					
					<div align="center">
					<table id="add_button">
					<tr>
								<td>In Add</td>
							</tr>
					<tr>
							  <td>
							  	<label><%= resource1.getString("serial_no") %> : </label>
							  </td>
							  <td >
							      <input type="text" name="deparmentSrno" readonly="readonly"  value=""/>
				              </td>
						 </tr>
						 <tr>
								<td>
									<label><%= resource1.getString("department_name") %> :	</label>
								</td>
								<td>
								  <input type="text" name="depatmentName" onKeyPress="return change(this,event);" value="" />
							    </td>
						 </tr>
						 <tr>
								<td>
									<label><%= resource1.getString("remark") %> : </label>
								</td>
								<td>
								  <input type="text" name="depatmentRemark" onKeyPress="return change(this,event);" value="" />
							    </td>
						 </tr>
						 <tr>
								<td colspan="2">
								 <div align="center"> 
									 <input type="submit" name="submit" value="insert" />
									 <input type="submit" name="submit" value="update" />
								 	 <input type="submit" name="submit" value="delete" />
								  </div>
								</td>
						 </tr>	
					 </table>	 		
					</div>
					<div align="center">
						<table>
							<% 						
								for(DepartmentBean db: result)
								{
							%>
							<tr>
								<td><a  href="javascript:callFun('<%= db.getDeptId() %>','<%= db.getDepartmentName() %>','<%= db.getRemark() %>')"><%= db.getDeptId() %></a></td>
								<td><%= db.getDepartmentName() %></td>
								<td><%= db.getRemark() %></td>
							</tr>
							<%
								}
							%>
						</table>
					</div>	
	
	
			  </form>
		
		  </div>
			
			
			
			</div>			
		</div>
		</div>
		</div>
			
		
		

    </body>
</html>